using System;
using System.Collections;
using System.IO;
using System.Text;
using System.Xml;
using Oracle.ManagedDataAccess.Client;
using Oracle.ManagedDataAccess.Types;
using OracleInternal.BinXml;
using OracleInternal.Common;
using OracleInternal.TTC.Accessors;

namespace OracleInternal.ServiceObjects
{
	internal class OracleXmlTypeImpl
	{
		internal object m_syncLock = new object();

		internal OracleConnectionImpl m_connImpl;

		internal OraXmlTypeData m_xmlTypeData;

		internal byte[] m_schemaID;

		internal byte[] m_schElem;

		internal byte[] m_snapshot;

		internal TypeOfXmlType m_typeOfXmlType;

		internal uint m_xmlFlag;

		internal Hashtable m_namespacesFromXmlDoc;

		internal string m_schemaUrlFromXmlDoc;

		internal string m_schemaNSFromXmlDoc;

		internal bool m_bIsFragment;

		internal bool m_bGotFragmentProp;

		internal bool m_bGotSchemaInfo;

		internal XmlDocumentFragment m_xmlDocFragmentInternal;

		internal bool m_bHasTargetNamespaceProp;

		internal int m_kpsnpLen = 34;

		internal static int GetKpsnpLen(OracleConnectionImpl connImpl)
		{
			if (!connImpl.IsServerUsingBigSCN)
			{
				return 24;
			}
			return 34;
		}

		internal OracleXmlTypeImpl()
		{
		}

		internal OracleXmlTypeImpl(OracleConnectionImpl connImpl)
		{
			m_kpsnpLen = GetKpsnpLen(connImpl);
		}

		internal OracleXmlTypeImpl(OracleConnectionImpl connImpl, TypeOfXmlType typeOfXmlType, TypeOfXmlData typeOfXmlData, object xmlValue)
			: this(connImpl)
		{
			m_connImpl = connImpl;
			m_typeOfXmlType = typeOfXmlType;
			m_xmlTypeData = new OraXmlTypeData(typeOfXmlData, xmlValue);
		}

		internal OracleXmlTypeImpl(OracleConnectionImpl connImpl, TTCXmlTypeAccessor XmlTypeAccessor, DataUnmarshaller dataUnmarshaller, int currentRow, int columnIndex)
			: this(connImpl)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)16777472, OracleTraceClassName.to, OracleTraceFuncName.OracleXmlTypeImpl);
			}
			try
			{
				m_connImpl = connImpl;
				OraXmlTypeHeader xmlTypeHeader = new OraXmlTypeHeader();
				XmlTypeAccessor.UnpickleXmlType(connImpl, dataUnmarshaller, currentRow, columnIndex, xmlTypeHeader, out m_xmlTypeData);
				PopulateXmlHeader(xmlTypeHeader);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)285212672, OracleTraceClassName.to, OracleTraceFuncName.OracleXmlTypeImpl, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)16777728, OracleTraceClassName.to, OracleTraceFuncName.OracleXmlTypeImpl);
				}
			}
		}

		internal OracleXmlTypeImpl(OracleConnectionImpl connImpl, OraXmlTypeHeader xmlTypeHeader, OraXmlTypeData xmlTypeData)
			: this(connImpl)
		{
			try
			{
				Set(connImpl, xmlTypeHeader, xmlTypeData);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)285212672, OracleTraceClassName.to, OracleTraceFuncName.OracleXmlTypeImpl, ex);
				throw;
			}
		}

		internal void PopulateXmlHeader(OraXmlTypeHeader xmlTypeHeader)
		{
			m_typeOfXmlType = xmlTypeHeader.m_typeOfXmlType;
			m_xmlFlag = xmlTypeHeader.m_xmlFlag;
			if (xmlTypeHeader.HasSchema())
			{
				m_schemaID = xmlTypeHeader.m_schoid;
				m_schElem = xmlTypeHeader.m_schElem;
			}
			m_bGotSchemaInfo = true;
			m_bIsFragment = xmlTypeHeader.IsFragment();
			m_bGotFragmentProp = true;
			m_snapshot = xmlTypeHeader.m_snapshot;
		}

		internal void Set(OracleConnectionImpl connImpl, OraXmlTypeHeader xmlTypeHeader, OraXmlTypeData xmlTypeData)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)16777472, OracleTraceClassName.to, OracleTraceFuncName.Set);
			}
			try
			{
				m_connImpl = connImpl;
				m_xmlTypeData = xmlTypeData;
				PopulateXmlHeader(xmlTypeHeader);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)285212672, OracleTraceClassName.to, OracleTraceFuncName.Set, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)16777728, OracleTraceClassName.to, OracleTraceFuncName.Set);
				}
			}
		}

		internal void Initialize(OracleConnection conn)
		{
			if (TypeOfXmlData.Clob == m_xmlTypeData.m_typeOfXmlData && m_xmlTypeData.m_xmlClob == null && m_xmlTypeData.m_xmlLobLocator != null)
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)16777472, OracleTraceClassName.to, OracleTraceFuncName.Initialize, "CLOB_OBJECT_STREAM_RECEIVED");
				}
				m_xmlTypeData.m_xmlClob = new OracleClob(conn, m_xmlTypeData.m_xmlLobLocator, bNClob: false, bCaching: false);
				m_xmlTypeData.m_xmlLobLocator = null;
			}
			else if (TypeOfXmlData.BlobWithText == m_xmlTypeData.m_typeOfXmlData && m_xmlTypeData.m_xmlBlobText == null && m_xmlTypeData.m_xmlLobLocator != null)
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)16777472, OracleTraceClassName.to, OracleTraceFuncName.Initialize, "BLOB_TEXT_STREAM_RECEIVED");
				}
				m_xmlTypeData.m_xmlBlobText = new OraXmlBlobWithText(conn, m_xmlTypeData.m_xmlLobLocator, m_xmlTypeData.m_csid);
				m_xmlTypeData.m_xmlLobLocator = null;
			}
			else if (TypeOfXmlData.BlobCSX == m_xmlTypeData.m_typeOfXmlData && m_xmlTypeData.m_xmlBlobCSX == null && m_xmlTypeData.m_xmlLobLocator != null)
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)16777472, OracleTraceClassName.to, OracleTraceFuncName.Initialize, "BINARY_XML_ENCODED_STREAM_RECEIVED");
				}
				m_xmlTypeData.m_xmlBlobCSX = new OracleBlob(conn, m_xmlTypeData.m_xmlLobLocator);
				m_xmlTypeData.m_typeOfXmlData |= TypeOfXmlData.BlobCSX;
				m_xmlTypeData.m_xmlLobLocator = null;
			}
		}

		internal void Dispose()
		{
			m_schemaNSFromXmlDoc = null;
			m_schemaUrlFromXmlDoc = null;
			m_namespacesFromXmlDoc = null;
			m_schemaID = null;
			m_schElem = null;
			m_snapshot = null;
			m_xmlFlag = 0u;
			m_typeOfXmlType = TypeOfXmlType.Null;
			lock (m_syncLock)
			{
				m_xmlTypeData.Dispose();
			}
			m_connImpl = null;
			m_xmlTypeData = null;
		}

		internal OracleXmlTypeImpl Clone()
		{
			OracleXmlTypeImpl oracleXmlTypeImpl = new OracleXmlTypeImpl();
			oracleXmlTypeImpl.m_typeOfXmlType = m_typeOfXmlType;
			lock (m_syncLock)
			{
				oracleXmlTypeImpl.m_xmlTypeData = m_xmlTypeData.Clone();
			}
			oracleXmlTypeImpl.m_schElem = m_schElem;
			oracleXmlTypeImpl.m_schemaID = m_schemaID;
			oracleXmlTypeImpl.m_snapshot = m_snapshot;
			oracleXmlTypeImpl.m_xmlFlag = m_xmlFlag;
			return oracleXmlTypeImpl;
		}

		internal bool IsEmptyXmlTypeData()
		{
			lock (m_syncLock)
			{
				switch (m_xmlTypeData.m_typeOfXmlData)
				{
				case TypeOfXmlData.NoData:
					return true;
				case TypeOfXmlData.Chars:
					return m_xmlTypeData.m_xmlChars.Length == 0;
				case TypeOfXmlData.String:
				case TypeOfXmlData.StringAndXmlDoc:
					return string.IsNullOrEmpty(m_xmlTypeData.m_xmlStr);
				case TypeOfXmlData.Clob:
				case TypeOfXmlData.ClobAndString:
					return m_xmlTypeData.m_xmlClob.IsEmpty;
				case TypeOfXmlData.BlobWithText:
				case TypeOfXmlData.BlobWithTextAndString:
					return m_xmlTypeData.m_xmlBlobText.IsEmpty;
				case TypeOfXmlData.BlobCSX:
					return false;
				case TypeOfXmlData.BlobCSXAndString:
					return string.IsNullOrEmpty(m_xmlTypeData.m_xmlStr);
				case TypeOfXmlData.XmlDoc:
					return string.IsNullOrEmpty(m_xmlTypeData.m_xmlDocInternal.OuterXml);
				}
			}
			return true;
		}

		internal void GetXmlDataForPickling(out TypeOfXmlData typeOfXmlData, out object xmlData)
		{
			lock (m_syncLock)
			{
				switch (m_xmlTypeData.m_typeOfXmlData)
				{
				case TypeOfXmlData.Chars:
					xmlData = m_xmlTypeData.m_xmlChars;
					typeOfXmlData = TypeOfXmlData.Chars;
					break;
				case TypeOfXmlData.Clob:
				case TypeOfXmlData.ClobAndString:
					xmlData = m_xmlTypeData.m_xmlClob;
					typeOfXmlData = TypeOfXmlData.Clob;
					break;
				case TypeOfXmlData.BlobWithText:
					xmlData = m_xmlTypeData.m_xmlBlobText.Value;
					typeOfXmlData = TypeOfXmlData.String;
					break;
				case TypeOfXmlData.BlobCSX:
				case TypeOfXmlData.BlobCSXAndString:
					xmlData = m_xmlTypeData.m_xmlBlobCSX;
					typeOfXmlData = TypeOfXmlData.BlobCSX;
					break;
				case TypeOfXmlData.String:
				case TypeOfXmlData.StringAndXmlDoc:
				case TypeOfXmlData.BlobWithTextAndString:
					xmlData = m_xmlTypeData.m_xmlStr;
					typeOfXmlData = TypeOfXmlData.String;
					break;
				case TypeOfXmlData.XmlDoc:
					if (m_xmlDocFragmentInternal != null && m_bIsFragment)
					{
						xmlData = m_xmlTypeData.m_xmlDocInternal.DocumentElement.InnerXml;
					}
					else
					{
						xmlData = m_xmlTypeData.m_xmlDocInternal.OuterXml;
					}
					typeOfXmlData = TypeOfXmlData.String;
					break;
				default:
					typeOfXmlData = TypeOfXmlData.NoData;
					xmlData = null;
					break;
				}
			}
		}

		internal string GetBinXmlDecodedString(OracleBlob blobCSX)
		{
			try
			{
				ObxmlDecodeStream decodeStream = m_connImpl.GetDecodeStream(blobCSX.Connection, blobCSX);
				string text = decodeStream.DecodeBlob();
				m_connImpl.CloseDecodeStream(decodeStream);
				return (text == null) ? string.Empty : text;
			}
			catch (Exception)
			{
				throw;
			}
		}

		internal StringBuilder GetBinXmlDecodedStringBuilder(OracleBlob blobCSX)
		{
			try
			{
				ObxmlDecodeStream decodeStream = m_connImpl.GetDecodeStream(blobCSX.Connection, blobCSX);
				StringBuilder result = decodeStream.DecodeBlobForXmlStream();
				m_connImpl.CloseDecodeStream(decodeStream);
				return result;
			}
			catch (Exception)
			{
				throw;
			}
		}

		internal string GetString()
		{
			lock (m_syncLock)
			{
				switch (m_xmlTypeData.m_typeOfXmlData)
				{
				case TypeOfXmlData.String:
				case TypeOfXmlData.ClobAndString:
				case TypeOfXmlData.StringAndXmlDoc:
				case TypeOfXmlData.BlobWithTextAndString:
				case TypeOfXmlData.BlobCSXAndString:
					return m_xmlTypeData.m_xmlStr;
				case TypeOfXmlData.Chars:
					m_xmlTypeData.m_xmlStr = new string(m_xmlTypeData.m_xmlChars);
					m_xmlTypeData.m_typeOfXmlData &= (TypeOfXmlData)(-17);
					m_xmlTypeData.m_xmlChars = null;
					m_xmlTypeData.m_typeOfXmlData |= TypeOfXmlData.String;
					return m_xmlTypeData.m_xmlStr;
				case TypeOfXmlData.Clob:
					m_xmlTypeData.m_xmlStr = m_xmlTypeData.m_xmlClob.Value;
					m_xmlTypeData.m_typeOfXmlData |= TypeOfXmlData.String;
					return m_xmlTypeData.m_xmlStr;
				case TypeOfXmlData.BlobWithText:
					m_xmlTypeData.m_xmlStr = m_xmlTypeData.m_xmlBlobText.Value;
					m_xmlTypeData.m_typeOfXmlData |= TypeOfXmlData.String;
					return m_xmlTypeData.m_xmlStr;
				case TypeOfXmlData.BlobCSX:
					m_xmlTypeData.m_xmlStr = GetBinXmlDecodedString(m_xmlTypeData.m_xmlBlobCSX);
					m_xmlTypeData.m_typeOfXmlData |= TypeOfXmlData.String;
					return m_xmlTypeData.m_xmlStr;
				case TypeOfXmlData.XmlDoc:
					if (m_xmlDocFragmentInternal != null && m_bIsFragment)
					{
						m_xmlTypeData.m_xmlStr = m_xmlTypeData.m_xmlDocInternal.DocumentElement.InnerXml;
					}
					else
					{
						m_xmlTypeData.m_xmlStr = m_xmlTypeData.m_xmlDocInternal.OuterXml;
					}
					m_xmlTypeData.m_typeOfXmlData |= TypeOfXmlData.String;
					return m_xmlTypeData.m_xmlStr;
				default:
					return string.Empty;
				}
			}
		}

		internal void GetXmlSchemaProp(out string schemaURL, out byte[] schemaID, out bool bHasTargetNamespace)
		{
			schemaURL = m_schemaUrlFromXmlDoc;
			schemaID = m_schemaID;
			bHasTargetNamespace = m_bHasTargetNamespaceProp;
		}

		internal XmlDocument GetXmlDocument(bool bInternalUse, bool bThrowException)
		{
			XmlDocument xmlDocument = null;
			XmlTypeReader xmlTypeReader = null;
			lock (m_syncLock)
			{
				if (TypeOfXmlData.XmlDoc == (m_xmlTypeData.m_typeOfXmlData & TypeOfXmlData.XmlDoc) && bInternalUse)
				{
					return m_xmlTypeData.m_xmlDocInternal;
				}
				switch (m_xmlTypeData.m_typeOfXmlData)
				{
				case TypeOfXmlData.Clob:
					m_xmlTypeData.m_xmlStr = m_xmlTypeData.m_xmlClob.Value;
					m_xmlTypeData.m_typeOfXmlData |= TypeOfXmlData.String;
					m_xmlTypeData.m_typeOfXmlData &= (TypeOfXmlData)(-5);
					m_xmlTypeData.m_xmlClob.Dispose();
					m_xmlTypeData.m_xmlClob = null;
					xmlTypeReader = new XmlTypeReader(new StringReader(m_xmlTypeData.m_xmlStr));
					break;
				case TypeOfXmlData.BlobWithText:
					m_xmlTypeData.m_xmlStr = m_xmlTypeData.m_xmlBlobText.Value;
					m_xmlTypeData.m_typeOfXmlData |= TypeOfXmlData.String;
					m_xmlTypeData.m_typeOfXmlData &= (TypeOfXmlData)(-65);
					m_xmlTypeData.m_xmlBlobText.Dispose();
					m_xmlTypeData.m_xmlBlobText = null;
					xmlTypeReader = new XmlTypeReader(new StringReader(m_xmlTypeData.m_xmlStr));
					break;
				case TypeOfXmlData.BlobCSX:
					m_xmlTypeData.m_xmlStr = GetBinXmlDecodedString(m_xmlTypeData.m_xmlBlobCSX);
					m_xmlTypeData.m_typeOfXmlData |= TypeOfXmlData.String;
					m_xmlTypeData.m_typeOfXmlData &= (TypeOfXmlData)(-129);
					m_xmlTypeData.m_xmlBlobCSX.Dispose();
					m_xmlTypeData.m_xmlBlobCSX = null;
					xmlTypeReader = new XmlTypeReader(new StringReader(m_xmlTypeData.m_xmlStr));
					break;
				case TypeOfXmlData.String:
				case TypeOfXmlData.ClobAndString:
				case TypeOfXmlData.StringAndXmlDoc:
				case TypeOfXmlData.BlobWithTextAndString:
				case TypeOfXmlData.BlobCSXAndString:
					xmlTypeReader = new XmlTypeReader(new StringReader(m_xmlTypeData.m_xmlStr));
					break;
				case TypeOfXmlData.Chars:
					m_xmlTypeData.m_xmlStr = new string(m_xmlTypeData.m_xmlChars);
					m_xmlTypeData.m_typeOfXmlData |= TypeOfXmlData.String;
					m_xmlTypeData.m_typeOfXmlData &= (TypeOfXmlData)(-17);
					m_xmlTypeData.m_xmlChars = null;
					xmlTypeReader = new XmlTypeReader(new StringReader(m_xmlTypeData.m_xmlStr));
					break;
				case TypeOfXmlData.XmlDoc:
					m_xmlTypeData.m_xmlStr = m_xmlTypeData.m_xmlDocInternal.OuterXml;
					m_xmlTypeData.m_typeOfXmlData |= TypeOfXmlData.String;
					xmlTypeReader = new XmlTypeReader(new StringReader(m_xmlTypeData.m_xmlStr));
					break;
				default:
					xmlTypeReader = new XmlTypeReader(new StringReader(""));
					break;
				}
				xmlDocument = DotNetXmlImpl.GetXmlDocument(xmlTypeReader, m_xmlTypeData.m_xmlStr, out m_xmlDocFragmentInternal, out m_bIsFragment, bThrowException);
				if (m_bIsFragment)
				{
					m_xmlTypeData.m_typeOfXmlData = TypeOfXmlData.XmlDoc;
				}
				m_bGotFragmentProp = true;
				m_bGotSchemaInfo = true;
				m_namespacesFromXmlDoc = xmlTypeReader.m_namespaces;
				m_schemaNSFromXmlDoc = xmlTypeReader.m_schemaXmlns;
				m_schemaUrlFromXmlDoc = xmlTypeReader.m_schemaURL;
				m_bHasTargetNamespaceProp = xmlTypeReader.m_bHasTargetNamespace;
				if (bInternalUse)
				{
					m_xmlTypeData.m_xmlDocInternal = xmlDocument;
					m_xmlTypeData.m_typeOfXmlData |= TypeOfXmlData.XmlDoc;
					return xmlDocument;
				}
				return xmlDocument;
			}
		}

		internal XmlReader GetXmlReader(XmlReaderSettings readerSettings)
		{
			lock (m_syncLock)
			{
				switch (m_xmlTypeData.m_typeOfXmlData)
				{
				case TypeOfXmlData.String:
				case TypeOfXmlData.ClobAndString:
				case TypeOfXmlData.StringAndXmlDoc:
				case TypeOfXmlData.BlobWithTextAndString:
				case TypeOfXmlData.BlobCSXAndString:
					return XmlReader.Create(new StringReader(m_xmlTypeData.m_xmlStr), readerSettings);
				case TypeOfXmlData.Clob:
					m_xmlTypeData.m_xmlStr = m_xmlTypeData.m_xmlClob.Value;
					m_xmlTypeData.m_typeOfXmlData |= TypeOfXmlData.String;
					return XmlReader.Create(new StringReader(m_xmlTypeData.m_xmlStr), readerSettings);
				case TypeOfXmlData.BlobWithText:
					m_xmlTypeData.m_xmlStr = m_xmlTypeData.m_xmlBlobText.Value;
					m_xmlTypeData.m_typeOfXmlData |= TypeOfXmlData.String;
					return XmlReader.Create(new StringReader(m_xmlTypeData.m_xmlStr), readerSettings);
				case TypeOfXmlData.BlobCSX:
					m_xmlTypeData.m_xmlStr = GetBinXmlDecodedString(m_xmlTypeData.m_xmlBlobCSX);
					m_xmlTypeData.m_typeOfXmlData |= TypeOfXmlData.String;
					return XmlReader.Create(new StringReader(m_xmlTypeData.m_xmlStr), readerSettings);
				case TypeOfXmlData.XmlDoc:
					if (m_xmlDocFragmentInternal != null && m_bIsFragment)
					{
						m_xmlTypeData.m_xmlStr = m_xmlTypeData.m_xmlDocInternal.DocumentElement.InnerXml;
					}
					else
					{
						m_xmlTypeData.m_xmlStr = m_xmlTypeData.m_xmlDocInternal.OuterXml;
					}
					m_xmlTypeData.m_typeOfXmlData |= TypeOfXmlData.String;
					return XmlReader.Create(new StringReader(m_xmlTypeData.m_xmlStr), readerSettings);
				case TypeOfXmlData.Chars:
					m_xmlTypeData.m_xmlStr = new string(m_xmlTypeData.m_xmlChars);
					m_xmlTypeData.m_typeOfXmlData &= (TypeOfXmlData)(-17);
					m_xmlTypeData.m_xmlChars = null;
					m_xmlTypeData.m_typeOfXmlData |= TypeOfXmlData.String;
					return XmlReader.Create(new StringReader(m_xmlTypeData.m_xmlStr), readerSettings);
				default:
					return XmlReader.Create(new StringReader(""));
				}
			}
		}

		internal void Invalidate(bool bOriginalFragmentValue, bool bValueIsFragment, ref bool bGotRootElement)
		{
			lock (m_syncLock)
			{
				if (m_typeOfXmlType == TypeOfXmlType.Clob || m_typeOfXmlType == TypeOfXmlType.BlobWithText)
				{
					m_typeOfXmlType = TypeOfXmlType.String;
				}
				m_xmlTypeData.m_typeOfXmlData &= (TypeOfXmlData)(-3);
				m_xmlTypeData.m_xmlStr = null;
				if (m_xmlTypeData.m_xmlClob != null)
				{
					m_xmlTypeData.m_xmlClob.Dispose();
					m_xmlTypeData.m_xmlClob = null;
					m_xmlTypeData.m_typeOfXmlData = TypeOfXmlData.XmlDoc;
				}
				else if (m_xmlTypeData.m_xmlBlobText != null)
				{
					m_xmlTypeData.m_xmlBlobText.Dispose();
					m_xmlTypeData.m_xmlBlobText = null;
					m_xmlTypeData.m_typeOfXmlData = TypeOfXmlData.XmlDoc;
				}
				if (bOriginalFragmentValue != bValueIsFragment)
				{
					bGotRootElement = false;
					if (bValueIsFragment)
					{
						m_xmlDocFragmentInternal = m_xmlTypeData.m_xmlDocInternal.CreateDocumentFragment();
						m_xmlDocFragmentInternal.InnerXml = m_xmlTypeData.m_xmlDocInternal.DocumentElement.InnerXml;
						m_xmlTypeData.m_typeOfXmlData = TypeOfXmlData.XmlDoc;
						m_bIsFragment = true;
						m_bGotFragmentProp = true;
					}
					else
					{
						m_xmlDocFragmentInternal = null;
						m_xmlTypeData.m_typeOfXmlData = TypeOfXmlData.XmlDoc;
						m_bIsFragment = false;
						m_bGotFragmentProp = false;
					}
				}
			}
		}
	}
}
